import "./PersonalUpdate.less"
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'
import Immutable from 'Immutable'
import pureRender from "pure-render-decorator"
import Tappable from "react-tappable"
import DefaultInput from "../../../components/DefaultInput"
import {fetchPersonal} from "../actions"

@pureRender
@connect((state)=>({
  personal:state.get("personal")
}))
export default class  extends Component {
  constructor(props){
    super(props)
    this.state={
      personal:this.props.personal
    }

  }

  componentDidMount(){
    this.props.dispatch(fetchPersonal())
  }

  componentWillReceiveProps(props){
    this.setState({
      personal:props.personal
    })
  }

  render() {
    console.log(777,this.state.personal.get("name"));
    return (
      <div className="personal-update">
        <DefaultInput value={this.state.personal.get("name")}  label="姓名"></DefaultInput>
        <DefaultInput value={this.state.personal.get("tel")}  label="手机号">
          {this.state.personal.get("tel")===""?null:
            <div className="tel-bind">解绑</div>
          }
        </DefaultInput>
        <DefaultInput value={this.state.personal.get("bankcard")}  label="银行卡"></DefaultInput>
        <DefaultInput value={this.state.personal.get("operatorName")}  label="归属人"></DefaultInput>

        <footer>
          <Tappable className="cancel">取消</Tappable>
          <Tappable className="save">保存</Tappable>

        </footer>
      </div>
    )
  }





}
